<template>
    <el-card class="box-card">
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="用户名">
          <el-input v-model="form.name"></el-input>
        </el-form-item>
        <el-form-item label="用户密码">
          <el-input v-model="form.password"></el-input>
        </el-form-item>
        <el-form-item label="姓名">
          <el-input v-model="form.realName"></el-input>
        </el-form-item>
        <el-form-item label="性别">
          <el-select v-model="form.sex" placeholder="选择性别">
            <el-option label="男" value="1"></el-option>
            <el-option label="女" value="0"></el-option>
          </el-select>
        </el-form-item>
        <input type="hidden" v-model="form.role" value="5"/>
        <el-form-item label="联系电话">
          <el-input v-model="form.tel"></el-input>
        </el-form-item>
        <el-form-item label="年龄">
          <el-input v-model="form.age"></el-input>
        </el-form-item>
        <el-form-item label="身份证">
          <el-input v-model="form.credit"></el-input>
        </el-form-item>
        <el-form-item label="过敏史">
          <el-input type="textarea"
                    :autosize="{ minRows: 3, maxRows: 6}"
                    v-model="form.anaphylaxis"></el-input>
        </el-form-item>


        <el-form-item>
          <el-button type="primary" @click="onSubmit">立即创建</el-button>
          <el-button @click="cancel">取消</el-button>
        </el-form-item>
      </el-form>
    </el-card>
</template>

<script>

  import {add} from '@/network/member'

  export default {
    name: 'MemberAdd',
    methods: {
      onSubmit() {
        console.log(this.form)
        add(this.form).then(res => {
          this.$router.back(1)
        })
      },
      cancel() {
        this.$router.back(1)
      }
    },
    data() {
      return {
        form: {
        }
      }
    }
  }
</script>

<style scoped>
  .el-input{
    width: 500px;
  }
</style>
